package com.dyh.quickdemo.bizDemo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;

/*
@Author=Joey Wheeler
@Date=2020/11/21 16:16
*/
public class LbdInF {

    public static void main(String[] args) {

    }

    @Setter@Getter@AllArgsConstructor
    class Req{
        Date start;
        Date end;
    }

    @Setter@Getter@AllArgsConstructor
    class Client{
        String url;
        String token;

        public Rsp execute(Req req){
            return new Rsp(new ArrayList<>());
        }
    }

    @Setter@Getter@AllArgsConstructor
    class Rsp{
        List<String> orderIds;
    }

    public interface CircuitBreaker{

    }

    public  void pullOrder(Date start,Date end){
        String url = "url";
        String token = "token";
        Req req = ((Supplier<Req>) ()-> new Req(start,end)).get();
        Client client =((Supplier<Client>)()->new Client("url","token")).get();
       // Rsp rsp client.execute(req);、

        Rsp rsp= ((Supplier<Client> & CircuitBreaker)()->new Client(url,token)).get()
                .execute( ((Supplier<Req> & Serializable) ()-> new Req(start,end)).get());

    }
}
